<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var obj = {
            name: '张美丽',
            age: 20,
            hobby: ['运动', '敲代码', '谈恋爱']
        };

        // for (var i = 0; i < obj.length; i++) {

        // }
        // 1.obj是一组无需的键值对的集合
        // console.log(obj.length);
        var copyObj = {};
        for (var key in obj) {
            console.log(obj[key]);
            // 复制地址
            // 判断复制的属性是什么类型的数据,初始化一个地址,然后再层层复制
            copyObj[key] = obj[key];
        };

    </script>
</body>

</html>